package com.aube.interact.fighter.card;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

/**
 * Created by huyaonan on 16/11/15.
 */
public class TaggedLayout extends FrameLayout {

    private Paint mPaint;

    public TaggedLayout(Context context) {
        this(context, null);
    }

    public TaggedLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TaggedLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setColor(Color.WHITE);
    }

    @Override
    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
        Rect mTmpRect = new Rect(0, 0, 5, getHeight());

        drawTag(canvas, mTmpRect);

        boolean ret = super.drawChild(canvas, child, drawingTime);
        return ret;
    }

    private void drawTag(Canvas canvas, Rect rect) {
        canvas.drawRect(rect, mPaint);
    }
}